const state = {
  addrList: JSON.parse(localStorage.addrList || '[]'),
  curAddr: {},
  areaList: {
    province_list: {
      110000: '北京省',
      120000: '天津省',
      130000: '湖南省',
      140000: '湖北省',
      150000: '广东省'
    },
    city_list: {
      110100: '北京市',
      120100: '天津市'
    },
    county_list: {
      110101: '东城区',
      110102: '西城区',
      110103: '朝阳区',
      120101: 'xxx区',
      120102: 'yyy区'
    }
  }
}

const mutations = {
  SET_ADDRESS(state, payload) {
    state.addrList.push(payload)
    localStorage.addrList = JSON.stringify(state.addrList)
  },
  GET_ADDRESS_BY_ID(state, payload) {
    state.curAddr = state.addrList.find(item => (item.id === payload))
  }
}

const actions = {

}

const getters = {

}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
